/* 
 * File:   atlas.h
 * Author: artem
 *
 * Created on August 30, 2011, 4:49 PM
 */

#ifndef ATLAS_H
#define ATLAS_H

#include "common.h"

struct rect_t
{
	uint16_t x;
	uint16_t y;
	uint16_t w;
	uint16_t h;
};

struct bitmap_t
{
	uint16_t w;
	uint16_t h;
	uint16_t data[];
};

struct node_t
{
	node_t   *left;
	node_t   *right;
	bitmap_t *bitmap;
	rect_t    rect;
};

struct atlas_t
{
	node_t *root;
};

atlas_t* atlas_create(uint16_t width, uint16_t height);
void atlas_destroy(atlas_t *atlas);

node_t* atlas_insert(atlas_t *atlas, bitmap_t *bitmap);
void atlas_assemble(const atlas_t *atlas, uint16_t *bitmap, uint16_t width, uint16_t height);

#endif /* ATLAS_H */
